{% extends "base.html" %}
{% load soclone_tags list_tags humanize %}

{% block bodyclass %}users{% endblock %}

{% block pageheader_content %}
<div class="tabs">
  <a href="{% url users %}?sort=reputation" title="Users with the highest reputation scores"{% ifequal sort "reputation" %} class="active"{% endifequal %}>Reputation</a>
  <a href="{% url users %}?sort=newest" title="Users who joined recently"{% ifequal sort "newest" %} class="active"{% endifequal %}>Newest</a>
  <a href="{% url users %}?sort=oldest" title="Users who have been members the longest"{% ifequal sort "oldest" %} class="active"{% endifequal %}>Oldest</a>
  <a href="{% url users %}?sort=name" title="Users in alphabetical order by display name"{% ifequal sort "name" %} class="active"{% endifequal %}>Name</a>
</div>
{% endblock %}

{% block content %}
<div id="users">
  <form name="user-filter-form" method="GET" action="{% url users %}">
    <p><label for="filter">Find users:</label> <input type="text" name="filter" id="filter" value="{{ filter|default:"" }}"><input type="hidden" name="sort" value="{{ sort }}"> <input type="submit" value="Search"></p>
  </form>
  <div class="user-lists">
    {% for user_list in users|in_batches_of_size:"7" %}
    <div class="user-list">
      {% for user_ in user_list%}
        <div class="user-info">
          <div class="user-gravatar32"><a href="{% url user user_.id %}{{ user_.username }}/">{% gravatar user_ 32 %}</a></div>
          <div class="user-details">
            <a href="{% url user user_.id %}{{ user_.username }}/">{{ user_.username }}</a>
            <br/>
            {% reputation user_ %}
          </div>
        </div>
      {% endfor %}
    </div>
    {% endfor %}
  </div>

  {% if page.has_other_pages %}
  <div class="pagination">
    {% if filter %}{% pager page sort=sort filter=filter %}{% else %}{% pager page sort=sort %}{% endif %}
  </div>
  {% endif %}
</div>
{% endblock %}